home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Resources / Chat & Communication / PeerAware 1.03 / PeerAware-Setup.exe / Html / start.js < prev    next >
Text File  |  2008-10-26  |  21KB  |  634 lines

  1. /*
  2. <!-- ***** BEGIN LICENSE BLOCK *****
  3.    - Version: MPL 1.1/LGPL 2.1
  4.    -
  5.    - The contents of this file are subject to the Mozilla Public License Version
  6.    - 1.1 (the "License"); you may not use this file except in compliance with
  7.    - the License. You may obtain a copy of the License at
  8.    - http://www.mozilla.org/MPL/
  9.    -
  10.    - Software distributed under the License is distributed on an "AS IS" basis,
  11.    - WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.    - for the specific language governing rights and limitations under the
  13.    - License.
  14.    -
  15.    - The Original Code is PeerAware Workspace User Interface.
  16.    -
  17.    - The Initial Developer of the Original Code is
  18.    - Imunin Software Inc.
  19.    - Portions created by the Initial Developer are Copyright (C) 2006-2008
  20.    - the Initial Developer. All Rights Reserved.
  21.    -
  22.    - Contributor(s):
  23.    -
  24.    - Alternatively, the contents of this file may be used under the terms of
  25.    - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  26.    - in which case the provisions of the LGPL are applicable instead
  27.    - of those above. If you wish to allow use of your version of this file only
  28.    - under the terms of the LGPL, and not to allow others to
  29.    - use your version of this file under the terms of the MPL, indicate your
  30.    - decision by deleting the provisions above and replace them with the notice
  31.    - and other provisions required by the LGPL. If you do not delete
  32.    - the provisions above, a recipient may use your version of this file under
  33.    - the terms of any one of the MPL or the LGPL.
  34.    -
  35.    - ***** END LICENSE BLOCK ***** --> 
  36. */
  37.  
  38. var LocalHubListBody;
  39. var LocalHubListCount = 0;
  40. var FavouriteHubListBody;
  41. var FavouriteHubListCount = 0;
  42.  
  43. var xmlHttpRequest;
  44. var xslt;
  45. gManageLocalHubs = false;
  46.  
  47. function show(object){document.all[object].style.visibility='visible';document.all[object].style.display='';}
  48. function hide(object){document.all[object].style.visibility='hidden';document.all[object].style.display='none';}
  49.  
  50. //web server
  51. var iWebServerPort;
  52. function openWebServer(){window.open("http://localhost:" + iWebServerPort + "/");}
  53. function SetLocalWebServerPort(aWebServerPort){iWebServerPort = aWebServerPort;}
  54.  
  55. //hub list
  56. var iDS;
  57. function SetPublicHublist(aHublist)
  58. {
  59.     iDS = aHublist;
  60.     //loadPublicList();
  61.     window.setTimeout('loadPublicList()', 10);
  62. }
  63.  
  64. //reg name
  65. function SetPeerAwareName(aName){document.all("PeerAwareName").innerHTML = aName;}
  66.  
  67. function loadPublicList()
  68. {
  69.     try
  70.     {
  71.         xmlHttpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  72.         xmlHttpRequest.open("GET", iDS, true);
  73.         xmlHttpRequest.onreadystatechange = function(){publicListLoaded();}
  74.         xmlHttpRequest.send(null);
  75.     }
  76.     catch (E)
  77.     {
  78.         document.all("plist").innerHTML = "Could not load " + url;
  79.     }
  80. }
  81.  
  82. function publicListLoaded()
  83. {
  84.     if (xmlHttpRequest.readyState == 4)
  85.     {
  86.         if(xmlHttpRequest.status == 200)
  87.         {
  88.             var xsl =  new ActiveXObject("Microsoft.XMLDOM");
  89.             xsl.async = false;
  90.             xsl.loadXML(xslt);
  91.             document.all("plist").innerHTML = xmlHttpRequest.responseXML.transformNode(xsl);
  92.         }
  93.         else
  94.         {
  95.             document.all("plist").innerHTML = "Could not load " + iDS + "<a href='javascript:window.location.reload();'> retry?</a>";
  96.         }
  97.     }
  98. }
  99.  
  100. function toFriendlySize(bs)
  101. {
  102.     if (bs >= 1024)
  103.     {
  104.         bs = bs / 1024;
  105.         if (bs >= 1024)
  106.         {
  107.             bs = bs / 1024;
  108.             if (bs >= 1024)
  109.             {
  110.                 bs = bs / 1024;
  111.                 if (bs >= 1024)
  112.                 {
  113.                     bs = bs / 1024;
  114.                     if (bs >= 1024)
  115.                     {
  116.                         bs = bs / 1024;
  117.                         return bs + ' TB';
  118.                     }
  119.                     else
  120.                         return bs + ' TB';
  121.                 }
  122.                 else
  123.                     return bs + ' GB';
  124.             }
  125.             else
  126.                 return bs + ' MB';
  127.         }
  128.         else
  129.             return bs + ' KB';
  130.     }
  131.     else
  132.         return bs + ' B';
  133. }
  134.  
  135. function AddLocalHub(hubName, hubDescription, hubAddress, maxUsers, minShare, localHub, localHost)
  136. {
  137.     var p1 = document.all[localHub + hubAddress];
  138.     var editingExisting = false;
  139.     if (p1 != undefined)
  140.     {
  141.         editingExisting = true;
  142.         while (p1.hasChildNodes())
  143.         {
  144.             p1.removeChild(p1.firstChild);
  145.         }
  146.     }
  147.     else
  148.     {
  149.         p1 = document.createElement('p');
  150.     }
  151.     p1.setAttribute("id", localHub + hubAddress);
  152.     var newLink = document.createElement('a');
  153.     newLink.setAttribute('href', hubAddress);
  154.     newLink.setAttribute('id', "address" + localHub + hubAddress);
  155.     var linkText=document.createTextNode(hubName);
  156.     newLink.appendChild(linkText);
  157.     p1.appendChild(newLink);
  158.     t=document.createElement("TABLE");
  159.     tb=document.createElement("TBODY");
  160.     cr=document.createElement("TR");
  161.     cc=document.createElement("TD");
  162.     cc.className="j";
  163.     f1=cc.appendChild(document.createElement("FONT"));
  164.     f1.setAttribute("size","-1");
  165.     var tt = document.createTextNode(hubDescription);
  166.     f1.appendChild(tt);
  167.     
  168.     var connectLink=document.createElement('a');
  169.     connectLink.setAttribute('href',hubAddress);
  170.     connectLink.className="arrow";
  171.     var connectText=document.createTextNode(" " + getTranslation(268));
  172.     connectLink.appendChild(connectText);
  173.     f1.appendChild(connectLink);
  174.         
  175.     f1.appendChild(document.createElement("br"));
  176.     f2=f1.appendChild(document.createElement("FONT"));
  177.     f2.setAttribute("size","-4");
  178.     f2.setAttribute("color","#008000");
  179.     f2.appendChild(document.createTextNode( hubAddress + " - " + getTranslation(53) + " " + maxUsers + " - " + getTranslation(54) + " " + toFriendlySize(minShare) + " - "));
  180.  
  181.     newLink=document.createElement('a');
  182.     if (localHub == "L$")
  183.     {
  184.         newLink.setAttribute('href',"javascript:window.external.AddFav('"  + hubName + "','" + hubAddress + "','"  + hubDescription + "','"  + maxUsers + "','"  + minShare + "');");
  185.         var linkText=document.createTextNode(getTranslation(269));
  186.         
  187.     }
  188.     else
  189.     {
  190.         newLink.setAttribute('href',"javascript:window.external.RemFav('" + hubAddress + "');");
  191.         var linkText=document.createTextNode("Delete");
  192.     }
  193.     newLink.className="fl";
  194.     newLink.appendChild(linkText);
  195.     f2.appendChild(newLink);
  196.  
  197.     if (localHub != "L$")
  198.     {
  199.         f2.appendChild(document.createTextNode(" - "));
  200.         newLink = document.createElement('a');
  201.         newLink.setAttribute('href',"javascript:EditFav('"  + hubName + "','" + hubAddress + "','"  + hubDescription + "','"  + maxUsers + "','"  + minShare + "','','" + localHub + "');");
  202.         var linkText=document.createTextNode("Edit");
  203.         newLink.className="fl";
  204.         newLink.appendChild(linkText);
  205.         f2.appendChild(newLink);
  206.     }
  207.  
  208.  
  209.     cr.appendChild(cc);
  210.     tb.appendChild(cr);
  211.     t.appendChild(tb);
  212.     p1.appendChild(t);
  213.     if (!editingExisting)
  214.     {
  215.         if (localHub == "L$")
  216.         {
  217.             LocalHubListBody.appendChild(p1);
  218.             LocalHubListCount++;
  219.             show("Local");
  220.             show('LocalList');
  221.         }
  222.         else
  223.         {
  224.             FavouriteHubListBody.appendChild(p1);
  225.             FavouriteHubListCount++;
  226.             show("Favourite");
  227.             show('FavouriteList');
  228.         }
  229.     }
  230.     if (localHost=="Y")
  231.     {
  232.         //navigate to the url:
  233.         if (gManageLocalHubs)
  234.         window.navigate("#address" + localHub + hubAddress);
  235.         
  236.         TestAvailability(hubAddress,hubName,hubDescription);
  237. /*
  238.         f2.appendChild(document.createTextNode(" - "));
  239.         newLink = document.createElement('a');
  240.         newLink.setAttribute('href',"javascript:TestAvailability('" + hubAddress + "','" + hubName + "','" + hubDescription +"');");
  241.         var linkText=document.createTextNode(getTranslation(267));
  242.         newLink.className="fl";
  243.         newLink.appendChild(linkText);
  244.         f2.appendChild(newLink);    */
  245.     }
  246. }
  247.  
  248. function AvailabilityHandler(xmlHttpRequest2, aHubAddress, aHubName, aHubDescription)
  249. {
  250.     if (xmlHttpRequest2.readyState == 4)
  251.     {
  252.         if(xmlHttpRequest2.status == 200)
  253.         {
  254.             if (xmlHttpRequest2.responseText.substr(0,3) == "YES")
  255.             {
  256.                 AvailabilityResult(true, aHubAddress, aHubName, aHubDescription, xmlHttpRequest2.responseText.substr(4));
  257.             }
  258.             else
  259.             {
  260.                 AvailabilityResult(false, aHubAddress, aHubName, aHubDescription, xmlHttpRequest2.responseText.substr(4));
  261.             }
  262.         }
  263.     }
  264. }
  265.  
  266. function TestAvailability(aHubAddress, aHubName, aHubDescription)
  267. {
  268.     try
  269.     {
  270.         var xmlHttpRequest2 = new ActiveXObject("Microsoft.XMLHTTP");
  271.             
  272.         var port = aHubAddress.substr(aHubAddress.indexOf(":", 5) + 1);
  273.         port = port.substr(0, port.indexOf("/"));
  274.         xmlHttpRequest2.open("GET", "http://www.peeraware.com/testworkspace.php?port=" 
  275.         + port + "&protocol=" + aHubAddress.substr(0, aHubAddress.indexOf(":")), true);
  276.  
  277.         xmlHttpRequest2.onreadystatechange = function(){AvailabilityHandler(xmlHttpRequest2, aHubAddress, aHubName, aHubDescription);}
  278.         xmlHttpRequest2.send(null);
  279.     }
  280.     catch (E)
  281.     {
  282.     }
  283. }
  284.  
  285. function AvailabilityResult(aSuccess, aHubAddress, aHubName, aHubDescription, aResult)
  286. {
  287.     var p2 = document.all["L$" + aHubAddress];
  288.     if (p2 != undefined)
  289.     {
  290.         var p1 = document.all["availability" + "L$" + aHubAddress];
  291.         if (p1 != undefined)
  292.         {
  293.             while (p1.hasChildNodes())
  294.             {
  295.                 p1.removeChild(p1.firstChild);
  296.             }
  297.         }
  298.         else
  299.         {
  300.             p1 = document.createElement('p');
  301.             p1.className="j";
  302.             p1.setAttribute("id", "availability" + "L$" + aHubAddress);
  303.             p2.appendChild(p1);
  304.         }
  305.         var text;
  306.         if (aSuccess)
  307.         {
  308.             f1 = p1.appendChild(document.createElement("IMG"));
  309.             f1.setAttribute("src","ok.gif");
  310.             text = document.createTextNode(getTranslation(232) + " ");
  311.             f1 = p1.appendChild(document.createElement("FONT"));
  312.             f1.setAttribute("size","-1");
  313.             f1.appendChild(text);
  314.             newLink = document.createElement('a');
  315.             newLink.setAttribute('href', aResult);
  316.             var linkText=document.createTextNode(aResult);
  317.             newLink.className="fl";
  318.             newLink.appendChild(linkText);
  319.             f1.appendChild(newLink);
  320.             f1.appendChild(document.createElement("BR"));
  321.             f1.appendChild(document.createElement("BR"));
  322.  
  323.             //invitation start
  324.             var divElement = document.createElement('div');
  325.             divElement.className = "invite";
  326.             linkText = document.createTextNode(getTranslation(290));
  327.             divElement.appendChild(linkText);
  328.             f1.appendChild(divElement);
  329.  
  330.             var table = document.createElement('table');
  331.             var row = table.insertRow(0);
  332.             var cell = row.insertCell(0);
  333.             var fimage = cell.appendChild(document.createElement("IMG"));
  334.             fimage.setAttribute("src","friends.gif");
  335.  
  336.             cell = row.insertCell(1);
  337.             cell.innerHTML = "<P style='font-size=16px;'><a href='mailto:mail@address?subject=" +
  338.             encodeURIComponent(getTranslation(283)) + "&body=" +
  339.             encodeURIComponent(getTranslation(284)) +
  340.             "%3A%0D%0A%0D%0A" + encodeURIComponent(getTranslation(285)) +
  341.             "%2C%0D%0A%0D%0A" + encodeURIComponent(getTranslation(286)) +
  342.             "%0D%0A" + encodeURIComponent(getTranslation(287)) + "%3A%0D%0A%0D%0A" +
  343.             encodeURIComponent("http://www.peeraware.com/invitation.php?url=" + aResult) +
  344.             "%0D%0A%0D%0A'>" + getTranslation(291) + "</a> " + getTranslation(292) + " <a href='" + "http://www.peeraware.com/invitation.php?url=" + aResult + "' target='_blank'>" + getTranslation(293) + "</a>. </P><P style='font-size=16px;'>" + getTranslation(294) + "</P>";
  345.             f1.appendChild(table);
  346.             //invitation end
  347.  
  348.             f1.appendChild(document.createElement("BR"));
  349.             newLink = document.createElement('a');
  350.             newLink.setAttribute('href', "http://www.peeraware.com/workspace/submit.php?url=" + encodeURIComponent(aResult) + "&title=" + encodeURIComponent(aHubName) + "&description=" + encodeURIComponent(aHubDescription));
  351.             newLink.setAttribute('target', "_blank");
  352.             var linkText=document.createTextNode(getTranslation(234));
  353.             newLink.className="fl";
  354.             newLink.appendChild(linkText);
  355.             linkText = document.createTextNode(getTranslation(233) + " ");
  356.             f1.appendChild(linkText);
  357.             f1.appendChild(newLink);
  358.             linkText = document.createTextNode(" " + getTranslation(235));
  359.             f1.appendChild(linkText);
  360.         }
  361.         else
  362.         {
  363.             f1 = p1.appendChild(document.createElement("IMG"));
  364.             f1.setAttribute("src","fail.gif");
  365.             text = document.createTextNode(getTranslation(236));
  366.             f1 = p1.appendChild(document.createElement("FONT"));
  367.             f1.setAttribute("size","-1");
  368.             f1.appendChild(text);
  369.             f1.appendChild(document.createElement("BR"));
  370.             f1.appendChild(document.createElement("BR"));
  371.  
  372.             //invitation start
  373.             var divElement = document.createElement('div');
  374.             divElement.className = "invite";
  375.             linkText = document.createTextNode(getTranslation(290));
  376.             divElement.appendChild(linkText);
  377.             f1.appendChild(divElement);
  378.  
  379.             var table = document.createElement('table');
  380.             var row = table.insertRow(0);
  381.             var cell = row.insertCell(0);
  382.             var fimage = cell.appendChild(document.createElement("IMG"));
  383.             fimage.setAttribute("src","friends.gif");
  384.  
  385.             cell = row.insertCell(1);
  386.             cell.innerHTML = "<P style='font-size=16px;'><a href='mailto:mail@address?subject=" +
  387.             encodeURIComponent(getTranslation(283)) + "&body=" +
  388.             encodeURIComponent(getTranslation(284)) +
  389.             "%3A%0D%0A%0D%0A" + encodeURIComponent(getTranslation(285)) +
  390.             "%2C%0D%0A%0D%0A" + encodeURIComponent(getTranslation(286)) +
  391.             "%0D%0A" + encodeURIComponent(getTranslation(287)) + "%3A%0D%0A%0D%0A" +
  392.             encodeURIComponent("http://www.peeraware.com/invitation.php?url=" + aResult) +
  393.             "%0D%0A%0D%0A'>" + getTranslation(291) + "</a> " + getTranslation(289) + " <a href='" + "http://www.peeraware.com/invitation.php?url=" + aResult + "' target='_blank'>" + getTranslation(293) + "</a>. </P><P style='font-size=16px;'>" + getTranslation(294) + "</P>";
  394.             f1.appendChild(table);
  395.             //invitation end
  396.         }
  397.     }
  398. }
  399.  
  400. function RemoveLocalHub(hubAddress,local)
  401. {
  402.     try
  403.     {
  404.         if (local == "L$")
  405.         {
  406.             LocalHubListBody.removeChild(document.getElementById(local + hubAddress));
  407.             LocalHubListCount--;
  408.             if (LocalHubListCount == 0)
  409.                 hide("Local");
  410.         }
  411.         else
  412.         {
  413.             FavouriteHubListBody.removeChild(document.getElementById(local + hubAddress));
  414.             FavouriteHubListCount--;
  415.             if (FavouriteHubListCount == 0)
  416.                 hide("Favourite");
  417.         }
  418.     }
  419.     catch (E){}
  420. }
  421.  
  422. function Activate(object)
  423. {
  424.     hide('ShowAbout');
  425.     //hide('Favourite');
  426.     //hide('Local');
  427.     //hide('Public');
  428.     //hide('FavouriteList');
  429.     //hide('LocalList');
  430.     //hide('PublicList');
  431.     
  432.     if (object=='FavouriteList' || object==null)
  433.     {
  434.         if (FavouriteHubListCount)
  435.         {
  436.             show('FavouriteList');
  437.             show('Favourite');
  438.         }
  439.         if (LocalHubListCount)
  440.         {
  441.             show('LocalList');
  442.             show('Local');
  443.         }
  444.         show('PublicList');
  445.         show('Public');
  446.         if (window.external.displayIntro())
  447.         {
  448.             //show("Checkbox2");
  449.             //show("Checkbox");
  450.             //show("ShowIntro");
  451.         }
  452.     }
  453.     else if (object=='ShowIntro')
  454.     {
  455.         //show("Checkbox2");
  456.         //show("Checkbox");
  457.         //show("ShowIntro");
  458.     }
  459.     else if (object=='ShowAbout')
  460.     {
  461.         show('ShowAbout');
  462.     }
  463. }
  464.  
  465. function getTranslation(aID)
  466. {
  467.     if (typeof(window.external)!="undefined" && typeof(window.external.getTranslation)!="undefined")
  468.         return window.external.getTranslation(aID);
  469. }
  470.  
  471. function $(aID)
  472. {
  473.     return document.getElementById(aID)
  474. }
  475.  
  476. function setLanguageStrings()
  477. {
  478.     //$("tws").innerHTML = getTranslation(140);
  479.     //$("tintro").innerHTML = getTranslation(183);
  480.     $("tabout").innerHTML = getTranslation(185);
  481.     $("tlearntouse").title=getTranslation(216);
  482.     $("tlearntouse2").title=getTranslation(216);
  483.     //$("tlearntouse2").innerHTML=getTranslation(183);
  484.     //$("tlearntouse3").title=getTranslation(216);
  485.     $("tuserguide").innerHTML=getTranslation(217);
  486.     //$("tvideotut1").title=getTranslation(219);
  487.     //$("tvideotut2").title=getTranslation(219);
  488.     //$("tvideotut2").innerHTML=getTranslation(220);
  489.     //$("tvideotut3").title=getTranslation(219);
  490.     //$("tvideotut4").innerHTML=getTranslation(219);
  491.     //$("tshowintro").innerHTML=getTranslation(221);
  492.     $("taboutheader").innerHTML=getTranslation(222);
  493.     $("taboutcopyright").innerHTML=getTranslation(223);
  494.     $("tlfav").innerHTML=getTranslation(224);
  495.     $("tnewfav").innerHTML=getTranslation(225);
  496.     $("taddfav").innerHTML=getTranslation(226);
  497.     $("taddfav").title=getTranslation(227);
  498.     $("tlocalnet").innerHTML=getTranslation(218);
  499.     $("tlocalnetdesc").innerHTML=getTranslation(228);
  500.     $("taddws").innerHTML=getTranslation(31);
  501.     $("taddws").title=getTranslation(229);
  502.     $("tinternet").innerHTML=getTranslation(230);
  503.     $("tinternetdes").innerHTML=getTranslation(231);
  504. }
  505.  
  506. function startPage()
  507. {
  508.     setLanguageStrings();
  509.     xslt='<?xml version="1.0" encoding="windows-1252"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"><xsl:template match="/">'
  510.     +"<xsl:for-each select='Hublist/Hubs/Hub'><p><a><xsl:attribute name='href'><xsl:value-of select='@Address' /></xsl:attribute><xsl:value-of select='@Name' /></a>"
  511.     +"<table cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td class='j'><font size='-1'>"
  512.     +"<xsl:value-of select='@Description'/><a class='arrow'><xsl:attribute name='href'><xsl:value-of select='@Address' /></xsl:attribute> Connect</a><br/><font size='-4' color='#008000'>"
  513.     +"<nobr><xsl:value-of select='@Address'/> - <xsl:value-of select='@Users'/>/<xsl:value-of select='@Maxusers'/> users - <xsl:value-of select='@Rating'/> - "
  514.     +'<xsl:choose>'
  515.     +'<xsl:when test="@Minshare < 1024"><xsl:value-of select="format-number'
  516.     +"(@Minshare, '#,##0')"
  517.     +'"/>Bytes</xsl:when>'
  518.     +'<xsl:when test="@Minshare < 1048576"><xsl:value-of select="format-number(@Minshare div 1024, '
  519.     +"'#,###.#')"
  520.     +'"/>KB</xsl:when>'
  521.     +'<xsl:when test="@Minshare < 1073741824"><xsl:value-of select="format-number(@Minshare div 1048576, '
  522.     +"'#,###.#')"
  523.     +'"/>MB</xsl:when>'
  524.     +'<xsl:when test="@Minshare"><xsl:value-of select="format-number(@Minshare div 1073741824,'
  525.     +" '#,###.#')"
  526.     +'"/>GB</xsl:when>'
  527.     +'<xsl:otherwise><xsl:text>No </xsl:text></xsl:otherwise>'
  528.     +'</xsl:choose>'
  529.     +" minimun share- <a><xsl:attribute name='href'>javascript:window.external.AddFav('<xsl:value-of select='@Name'/>','<xsl:value-of select='@Address'/>','<xsl:value-of select='@Description'/>','<xsl:value-of select='@Maxusers'/>','<xsl:value-of select='@Minshare'/>');</xsl:attribute> <xsl:attribute name='class'>fl</xsl:attribute>Add to Favorites</a></nobr>"
  530.     +"</font></font></td></tr></tbody></table></p></xsl:for-each></xsl:template></xsl:stylesheet>";
  531.  
  532.     //if (window.external.displayIntro())
  533.     //{
  534.     //    document.all("Checkbox").checked = true;
  535.     //}
  536.     //Activate('FavouriteList');
  537.  
  538.     LocalHubListBody = document.getElementById('llist');
  539.     FavouriteHubListBody = document.getElementById('flist');
  540.     window.external.pageLoaded();
  541. }
  542.  
  543. function AddInputField(aForm, aInputName, aIdName, aInputValue, aId)
  544. {
  545.     aForm.appendChild(document.createTextNode(aInputName+": "));
  546.     var edit = document.createElement("input");
  547.     if (aInputValue != "undefined")
  548.         edit.value = aInputValue;
  549.  
  550.     edit.setAttribute("id", aIdName + "edit" + aId);
  551.     aForm.appendChild(edit);
  552.     mybreak=document.createElement("BR");
  553.     aForm.appendChild(mybreak); 
  554. }
  555.  
  556. function hubEditSave(e)
  557. {
  558.     var hubName, hubDescription, hubAddress, maxUsers, minShare, localHub;
  559.     localHub = "F$";
  560.     hubName = document.all["Nameedit" + e].value;
  561.     hubAddress = document.all["Addressedit" + e].value;
  562.     hubDescription = document.all["Descriptionedit" + e].value;
  563.  
  564.     if (hubAddress=="")
  565.         alert("Address must  have a value.");
  566.     else
  567.     {
  568.         if (hubAddress.search("pa://")==-1)
  569.             hubAddress = "pa://" + hubAddress;
  570.         window.external.UpdateFav(e, hubName, hubAddress, hubDescription);
  571.         if (e!='newfav')
  572.             AddLocalHub(hubName, hubDescription, hubAddress, 0, 0, localHub, '');
  573.         else
  574.             hubEditCancel(e);
  575.     }
  576. }
  577.  
  578. function hubEditCancel(e)
  579. {
  580.     var t = document.all["edit" + e];
  581.     var p = t.parentNode;
  582.     p.removeChild(t);
  583.     if (FavouriteHubListCount == 0)
  584.     {
  585.         hide("Favourite");
  586.         hide('FavouriteList');
  587.     }
  588. }
  589.  
  590. function EditFav(aHubName, aHubAddress, aHubDescription, aMaxUsers, aMinShare, aSecure, aLocalHub)
  591. {
  592.     hide('ShowAbout');
  593.     show("Favourite");
  594.     show('FavouriteList');
  595.  
  596.     if(document.all["edit" + aLocalHub + aHubAddress] == undefined)
  597.     {
  598.         var p1 = document.createElement('p');
  599.         p1.className = "g";
  600.         p1.setAttribute("id", "edit" + aLocalHub + aHubAddress);
  601.  
  602.         var myform = document.createElement("form");
  603.         p1.appendChild(myform); 
  604.         mybreak=document.createElement("p"); 
  605.         myform.appendChild(mybreak); 
  606.         
  607.         AddInputField(myform, getTranslation(1), "Name", aHubName, aLocalHub + aHubAddress);
  608.         AddInputField(myform, getTranslation(272), "Description", aHubAddress, aLocalHub + aHubAddress);
  609.         AddInputField(myform, getTranslation(2), "Address", aHubDescription, aLocalHub + aHubAddress);
  610.  
  611.         mybutton=document.createElement("BUTTON");
  612.         mybutton.onclick = function(){hubEditSave(aLocalHub + aHubAddress);};
  613.  
  614.         theText=document.createTextNode(getTranslation(270));
  615.         mybutton.appendChild(theText);
  616.         myform.appendChild(mybutton);
  617.  
  618.         mybutton=document.createElement("BUTTON");
  619.         mybutton.onclick = function(){hubEditCancel(aLocalHub + aHubAddress);};
  620.         
  621.         theText=document.createTextNode(getTranslation(271));
  622.         mybutton.appendChild(theText);
  623.         myform.appendChild(mybutton);
  624.         document.all[aLocalHub + aHubAddress].appendChild(p1);
  625.     }
  626. }
  627. function showIntroOnStartup(intro)
  628. {
  629.     if(intro.checked == true)
  630.         window.external.setDisplayIntro(true);
  631.     else
  632.         window.external.setDisplayIntro(false);
  633. }
  634.